package win.larryzeal.logdemo.config.props;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

@Component
@PropertySource("classpath:datasource.properties")
public class DruidDataSourceProperties {
	/** jdbc **/
	@Value("${connection.driver_class}")
	private String driverClass;
	@Value("${connection.url}")
	private String url;
	@Value("${connection.username}")
	private String username;
	@Value("${connection.password}")
	private String password;

	/** druid datasource **/
	@Value("${maxActive}")
	private Integer maxActive;
	@Value("${initialSize}")
	private Integer initialSize;
	@Value("${maxWait}")
	private Long maxWait;
	@Value("${minIdle}")
	private Integer minIdle;
	@Value("${timeBetweenEvictionRunsMillis}")
	private Long timeBetweenEvictionRunsMillis;
	@Value("${minEvictableIdleTimeMillis}")
	private Long minEvictableIdleTimeMillis;
	@Value("${validationQuery}")
	private String validationQuery;
	@Value("${testWhileIdle}")
	private Boolean testWhileIdle;
	@Value("${testOnBorrow}")
	private Boolean testOnBorrow;
	@Value("${testOnReturn}")
	private Boolean testOnReturn;
	@Value("${maxOpenPreparedStatements}")
	private Integer maxOpenPreparedStatements;
	@Value("${removeAbandoned}")
	private Boolean removeAbandoned;
	@Value("${removeAbandonedTimeout}")
	private Integer removeAbandonedTimeout;
	@Value("${logAbandoned}")
	private Boolean logAbandoned;
	@Value("${filters}")
	private String filters;

	/********* getters ********/
	public String getDriverClass() {
		return this.driverClass;
	}

	public String getUrl() {
		return this.url;
	}

	public String getUsername() {
		return this.username;
	}

	public String getPassword() {
		return this.password;
	}

	public Integer getMaxActive() {
		return this.maxActive;
	}

	public Integer getInitialSize() {
		return this.initialSize;
	}

	public Long getMaxWait() {
		return this.maxWait;
	}

	public Integer getMinIdle() {
		return this.minIdle;
	}

	public Long getTimeBetweenEvictionRunsMillis() {
		return this.timeBetweenEvictionRunsMillis;
	}

	public Long getMinEvictableIdleTimeMillis() {
		return this.minEvictableIdleTimeMillis;
	}

	public String getValidationQuery() {
		return this.validationQuery;
	}

	public Boolean getTestWhileIdle() {
		return this.testWhileIdle;
	}

	public Boolean getTestOnBorrow() {
		return this.testOnBorrow;
	}

	public Boolean getTestOnReturn() {
		return this.testOnReturn;
	}

	public Integer getMaxOpenPreparedStatements() {
		return this.maxOpenPreparedStatements;
	}

	public Boolean getRemoveAbandoned() {
		return this.removeAbandoned;
	}

	public Integer getRemoveAbandonedTimeout() {
		return this.removeAbandonedTimeout;
	}

	public Boolean getLogAbandoned() {
		return this.logAbandoned;
	}

	public String getFilters() {
		return this.filters;
	}

}
